<?php

$traduccion = new Zend_Translate('array', APPLICATION_PATH . '/idiomas/es.php', 'es');  
Zend_Form::setDefaultTranslator($traduccion);  

class Application_Form_Login extends Zend_Form
{
    protected function generaDecorador() {
         return array(
                    array('Errors',array('tag' => 'div')),
                    'ViewHelper',
                    'Description',
                    array('Label',array('class' => 'imitar_h2')),
                    array('HtmlTag', array('tag' => 'Fieldset', 'class' => 'elemento'))
                ); 
    }

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
        $this->addElement(
            'text', 'usuario', array(
                    'label' => 'Usuario:',
                    'decorators' => $this->generaDecorador(),
                    'required' => true,
                    /*'validators' => array(
                        array('validator' => 'Alnum', 'options' => array(
                            'messages'=>array(
                                'notAlnum'=>'Solo puede usar letras y números'
                            ) 
                        ))*/
                    array('alnum')
                )
        );

        $this->addElement(
            'password', 'clave', array(
                    'label' => 'Contraseña:',
                    'decorators' => $this->generaDecorador(),
                    'required' => true
                )
        );

        $this->addElement(
            'submit', 'Ingresar', array('class' => 'btn btn-large btn-warning')
        );
        
        $this->setAction('/auth/login');
        $this->setMethod('post');
                
    }
    
}

